#include "udp_client.hpp"
#include <memory>

void usage(const std::string& proc)
{
    std::cout << "Usage\n\t" << proc << " server_ip server_port" << std::endl;
}

// ./udp_client server_ip server_port
int main(int argc, char* argv[])
{
#if defined (__linux__) || defined (__APPLE__)
    if (argc != 3)
    {
        usage(argv[0]);
        exit(CMD_ERR);
    }

    std::string sip = argv[1];
    uint16_t sport = std::stoi(argv[2]);
#elif defined (WIN32) || defined (WIN64)
    std::string sip = "1.94.40.125";
    uint16_t sport = 8080;
#endif

    std::unique_ptr<udp::udp_client> ucli(new udp::udp_client(sip, sport));
    ucli->init_server();
    ucli->start();


    return 0;
}
